package com.lc.util;

import java.util.List;

/**
 * @description:分页工具类
 * @author: ManolinCoder
 * @time: 2021/8/23
 */
public class PageUtil {
    //1.当前页码值 2.显示条数 3.查询结果列表 4.查询总条数 5.总页数
    private Integer pageIndex;
    private Integer pageSize=5;
    private List dataList;
    private Integer total;
    private Integer totalPages;

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public List getDataList() {
        return dataList;
    }

    public void setDataList(List dataList) {
        this.dataList = dataList;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getTotalPages() {
        //获取总页数=总数据条数%每页显示的条数>0?总数据条数/每页显示的条数+1:总数据条数/每页显示的条数
        return total%pageSize>0?total/pageSize+1:total/pageSize;
    }

    public void setTotalPages(Integer totalPages) {
        this.totalPages = totalPages;
    }
}
